Enable ROR-Based Org Creation for Contributors#1243
Enable ROR-Based Org Creation for Contributors#1243momo3404 wants to merge 18 commits intointegrationfrom
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
This is a step forward, but I still can't help but wonder if moving the bulk of this logic inside of app/services/org_selection/hash_to_org_service.rb will simplify things even more.
You have 'shared/org_selectors/combined' in app/views/contributors/_form.html.erb, which is good; it should enable the ROR querying in the user search.
However, when I test it from integration it doesn't seem to work. It looks like the issue is the following:
# app/services/external_apis/ror_service.rb
def ping
return true unless active? && heartbeat_path.present?
resp = http_get(uri: "#{api_base_url}#{heartbeat_path}")
byebug
resp.present? && resp.code == 200
end(byebug) api_base_url
"https://api.ror.org/v1/"
(byebug) resp.present? && resp.code == 200
false
(byebug) resp
#<HTTParty::Response:0x10608 parsed_response={"errors"=>[{"status"=>"410", "title"=>"API Version Deprecated", "detail"=>"The v1 API has been deprecated. Please migrate to v2."}]}, @response=#<Net::HTTPGone 410 Gone readbody=true>, @headers={"date"=>["Tue, 09 Dec 2025 16:55:16 GMT"], "content-type"=>["application/json"], "content-length"=>["133"], "connection"=>["close"], "x-amzn-requestid"=>["23c106ef-fced-4488-a903-a468c6fd4d05"], "x-amzn-remapped-connection"=>["keep-alive"], "x-amz-apigw-id"=>["VVIiTH5ujoEEY0w="], "vary"=>["Origin"], "x-amzn-remapped-server"=>["nginx/1.18.0 + Phusion Passenger 6.0.7"], "status"=>["410 Gone"], "x-powered-by"=>["Phusion Passenger 6.0.7"], "x-amzn-remapped-date"=>["Tue, 09 Dec 2025 16:55:16 GMT"]}>
(byebug)
According to https://ror.readme.io/, as of today, api v1 is no longer available:
As of December 9, 2025, version 1 of the ROR schema and API has been sunset, meaning that ROR API requests with v1 in the path no longer return results, v1 files will no longer be included in the ROR data dump, and v1 documentation is no longer available. Read more in our changelog.
I think moving |
I'm still wondering if You have 'shared/org_selectors/combined' in app/views/contributors/_form.html.erb, which is good; it should enable the ROR querying in the user search.
I could be wrong, but after the work we did in I'd try setting I'm looking at |
The combined org partial allows for a search for orgs outside of the local DB, and includes external orgs with valid RORs
Updated process_org to parse org_id input and check for an existing Org using the HashToOrgService before calling org_from_params. This avoids redundant calls to org_from_params and speeds up the process of adding a contributor if their org already exists in the DB. Also added finalize_org_hash helper method to avoid reuse of same code
- Add validate_ror helper function that makes an external API ROR request to ensure the external org picked from the dropdown has a valid ROR and that it is the correct one - This allows valid external orgs with RORs to be added to the DB - Also edit parse rescue result to nil since that is more readable
- The test stubs org_from_params to return new_org, but process_org may skip using new_org if it finds a different existing org based on org_name or parsed['id']. - The fix makes the test avoid real org lookup by clearing values that might cause that. This ensures existing_org_from_hash returns nil, allowing the stubbed org_from_params to be used.
- Use the debounce function to create debouncedToggleWarning. - Edit handleSelection to display the autocomplete warning only after 1 second of paused typing and hide it when user is typing
- Flash message displays when an org is not present in orgs table AND does not pass ROR validation - Add request.present? to message condition in order for controller tests to work properly
868ecf3 to
7ca17b2
Compare
d5217a2 to
31fb8d9
Compare
- Stub ror hash to allow for new org creation
|
Maybe something like |
Sounds good, I can change it for the official PR once we're done with the draft one. |
|
This PR will prevent users from adding "junk orgs" to the db. At the same time, we should try to not render those junk orgs in the dropdown list. For example, we probably don't want users to see all of these "test" options. We should try to figure out a way to filter out these unwanted orgs. Edit: I might try to expand upon #1250. Maybe some more "junk orgs" could be removed via this rake task. |
I agree that the prior behaviour of saving the contributor should remain as is, I'll change the flash message. |
I think a separate rake task to address this would be the best solution. Could be part of the next release with this and the funders PR. |






Fixes #926.
Changes proposed in this PR: